﻿using ECommerce.Web.Models;
using NHibernate;

namespace ECommerce.Web.FetchingStrategies
{
    public class ShopperWithBasketFetchingStrategy : IFetchingStrategy<IShopperWithBasket>
    {
        public ICriteria AddFetchJoinTo(ICriteria criteria)
        {
            return criteria
                .SetFetchMode("Basket", FetchMode.Eager)
                .SetFetchMode("Basket.Items", FetchMode.Eager)
                .SetFetchMode("Basket.Items.Product", FetchMode.Eager);
        }
    }
}
